<!doctype html>
<html>
<head>
<include file="public:headtop" />
<link href="/static/css/general.css" rel="stylesheet">
<link href="/static/css/result.css" rel="stylesheet">
<link href="/static/css/address.css" rel="stylesheet">
<!--<link href="/static/css/jquery_dialog.css" rel="stylesheet">-->
<!--<link href="/static/css/animate.css" rel="stylesheet">-->
<!--<script src="/static/js/jquery_dialog.js"></script>-->
</head>

<body class="bg-grey">

    <div class="title-bar my-container">
        <h3>订单信息(编号：<span class="text-red">{$ord.sn}</span>)</h3>
    </div>

	<ul class="result-box">
        <li>下单时间：{$ord.add_time}</li>
		<li>金额：￥{$ord.count}元</li>
        <li>实际支付：￥{$ord.zhifue}元</li>
		<li>
            订单状态： &nbsp;<?php echo $status_arr[$ord['status']]; ?>
        </li>
        <if condition="isset($dl)">
            <li>物流单号：&nbsp;{$dl.postid}&nbsp;<a href="" class="link" id="Wuliu">跟踪</a></li>
        </if>
    </ul>

    <div class="title-bar my-container">
        <h3>收件信息</h3>
    </div>

    <ul class="result-box">
        <li>收件人：{$add.user_name}</li>
        <li>联系方式：{$add.user_tel}</li>
        <li>地址：{$add.address}</li>
    </ul>

    <div class="title-bar my-container">
        <h3>商品信息</h3>
    </div>

    <table class="media result-box">
        <volist name="goo" id="g">
            <tr>
                <td class="media-img"><img src="{$g.img}" class="img-responsive" alt=""/></td>
                <td>
                    <h3 class="media-title">{$g.title}</h3>
                    <span class="media-text">数量：{$ord.num}</span>
                </td>
            </tr>
        </volist>
    </table>

     <div class="last-box">
        <button id="Credit" onclick="jiesuan()">立即支付</button>
        
    </div>

    <script>
        $(function() {
            var wuliu = document.getElementById('Wuliu');
            if(wuliu) {
                wuliu.href = "http://m.kuaidi100.com/index_all.html?type={$dl.company}&postid={$dl.postid}&callbackurl=" + encodeURIComponent(location.href);
            }
        });
       

    function jiesuan() {

        $.getJSON("{:U('pay')}", function(data) {
            // alert(JSON.stringify(data))

            WeixinJSBridge.invoke('getBrandWCPayRequest', data.data,
                function(res){
                    WeixinJSBridge.log(res.err_msg);
                    var ref_msg = res.err_msg;
                    if(ref_msg == 'get_brand_wcpay_request:ok'){
                        location.href='/index.php?m=Item&a=update_order&sn=' + "{$ord.sn}";
                    }else if(ref_msg == 'get_brand_wcpat_request:cancel'){
                        alert('支付已经取消！');
                    } else {
                        alert('支付失败！');
                    }
                }
            );
        })
    }
    </script>
</body>
</html>